#
# /*
#  *  This program is free software: you can redistribute it and/or modify
#  *  it under the terms of the GNU General Public License as published by
#  *  the Free Software Foundation, either version 3 of the License, or
#  *  (at your option) any later version.
#  *
#  *  This program is distributed in the hope that it will be useful,
#  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  *  GNU General Public License for more details.
#  *
#  *  You should have received a copy of the GNU General Public License
#  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
#  *
#  * SPDX-License-Identifier: GPL-3.0+
#  * License-Filename: LICENSE
#  *
#  */
#

bin_PROGRAMS=gplflex

#
gplflex_SOURCES = \
	main.c \
	options.c \
	dpmem.c \
	lex.tab.c

#
gplflex_HSOURCES = \
	main.h \
	lex.tab.h


#
gplflex_CFLAGS = \
	@CFLAGS@ @PACKAGE_CFLAGS@ @WARNING_CFLAGS@

gplflex_10_CFLAGS = \
	-fanalyzer -fdump-analyzer-callgraph -fdump-analyzer-exploded-graph -fdump-analyzer-supergraph -fdump-analyzer-state-purge -fcallgraph-info=da -fdump-rtl-expand-graph -fdump-tree-cfg-graph -fdump-ipa-all-graph

#
gplflex_tolink = 

#
gplflex$(EXEEXT): $(gplflex_SOURCES)
	$(CC) $(gplflex_CFLAGS) $(gplflex_SOURCES) -I. -I.. $(gplflex_tolink) -o gplflex

#
indent:
	./Lindent $(gplflex_SOURCES) $(gplflex_HSOURCES)

# graph data using gcc-11
gdata:
	$(CC) $(gplflex_10_CFLAGS) $(gplflex_CFLAGS) dpmem.c -I. -I.. $(gplflex_tolink) -c

# graph data using clang-8
gdata8:
	clang-8 -c -emit-llvm -I. -I.. dpmem.c -o dpmem.bc
	opt-8 -dot-cfg-only dpmem.bc
	opt-8 -dot-cfg dpmem.bc
	opt-8 -dot-dom dpmem.bc
	opt-8 -dot-dom-only dpmem.bc
	opt-8 -dot-postdom dpmem.bc
	opt-8 -dot-postdom-only dpmem.bc
	opt-8 -dot-callgraph dpmem.bc

#
clean-generic:
	rm -v -f *.bc
	rm -v -f ./a.out
	rm -v -f *~
	rm -v -f ./*.o
	rm -v -f ./*.a
	rm -v -f ./*.i
	rm -v -f ./*.s
	rm -v -f ./O
	rm -v -f ./OO
	rm -v -f ./O1
	rm -v -f ./O2
	rm -v -f ./O3
	rm -v -f ./ID
	rm -v -f ./dsmake.output
	rm -v -f ./dsmake.warnings
	rm -v -f ./dsmake.errors
	rm -v -f *.*r.*
	rm -v -f *.*t.*
	rm -v -f *.bc
	rm -v -f *.plist
	rm -v -f *.ps
	rm -v -f *.dot
	rm -v -f *.ci

# /* end */
